// 滚动动画
document.addEventListener('DOMContentLoaded', function() {
    // 观察器用于滚动动画
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('visible');
            }
        });
    });

    // 观察所有需要动画的元素
    document.querySelectorAll('.fade-in').forEach((el) => {
        observer.observe(el);
    });

    // 表单提交动画
    const contactForm = document.querySelector('form');
    if (contactForm) {
        contactForm.addEventListener('submit', function(e) {
            const button = this.querySelector('button');
            button.innerHTML = '<div class="loading"></div> 发送中...';
            button.disabled = true;
        });
    }
});